#!/usr/bin/env python
#coding=utf-8
"""
for centos 6:
yum install mysql-server mysql-devel
yum install mysqldb-python（centos）
yum install mongodb mongodb-server

pip install mysql-python(ubuntu/Mac下)
pip install pymongo（Ubuntu/Mac下）
pip install pymongo==2.6.3
pip install --upgrade pymongo

mysql:
create table classmember5(id int(4) not null primary key auto_increment, name char(20) not null, sex int(1));
insert into classmember5 values(0,'chenronghua', 1);
insert into classmember5 values(2,'zhangqing', 0);
insert into classmember5 values(3,'matianhai', 1);
update classmember5 set name='matianhai1' where id=3;
"""

import pymongo

def test_mongo():
    connect = pymongo.Connection('172.16.213.128', 27017)
    db = connect.test
    tb = db.classmember5
    m1 = {'name':'mingmings', 'age':18, 'job':'nihao'}
    tb.insert(m1)

    for i in tb.find({}):
        print i

if __name__ == '__main__':
    test_mongo()